<?php
// +----------------------------------------------------------------------
// | OneKeyAdmin [ Believe that you can do better ]
// +----------------------------------------------------------------------
// | Copyright (c) 2020-2023 http://onekeyadmin.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: MUKE <513038996@qq.com>
// +----------------------------------------------------------------------
namespace plugins\ip\api\listen;

use app\api\model\Config;

class AppCheck
{
    public function handle()
    {
        $config = Config::getVal('app_ip');
        if ($config) {
            if (isset($config['ip']) && !empty($config['ip']) && $config['open'] == 1) {
                $arrIp = explode(",", $config['ip']);
                if (in_array(request()->ip(), $arrIp)) {
                    return abort(403);
                }
            }
        }
    }
}